//
//  JWLeftTabBar.h
//  JWCustomLeftTabBar
//
//  Created by sunjiawei on 2022/12/26.
//

#import <UIKit/UIKit.h>
#import <Masonry.h>
#import <YYKit/YYKit.h>

#define HexRGB(rgbValue) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0]
#define kStatusBarHeight [[UIApplication sharedApplication] statusBarFrame].size.height


NS_ASSUME_NONNULL_BEGIN

@interface JWLabel : UILabel

@property(nonatomic, assign) UIEdgeInsets edgeInsets;

@end


@interface JWLeftTabBarItem : UIButton
/// 未读数
@property (nonatomic, strong) JWLabel *numLa;

@end

@class JWLeftTabBar;

@protocol JWLeftTabBarDelegate <NSObject>
@optional
/// 是否可以选中
/// @param tabbar tabbar
/// @param index 位置
- (BOOL)leftTabbar:(JWLeftTabBar *)tabbar shouldSelectWithIndex:(NSInteger)index;
/// 选中后
/// @param tabbar tabbar
/// @param index 位置
- (void)leftTabbar:(JWLeftTabBar *)tabbar didSelectWithIndex:(NSInteger)index;

@end

@interface JWLeftTabBar : UIView
/// 头像
@property (nonatomic, strong, readonly) UIImageView *avatarImageView;
/// item数组
@property (nonatomic, strong, readonly) NSMutableArray <JWLeftTabBarItem *> *itemArr;
/// 当前选中
@property (nonatomic, assign, readonly) NSUInteger curSelectIndex;
/// 点击处理代理
@property (nonatomic, weak) id <JWLeftTabBarDelegate> delegate;
/// 加载item
- (void)loadAllItems;
/// 移除所有item
- (void)removeAllItems;
/// 添加item
/// @param title 标题
/// @param image 未选中图片
/// @param selectedImage 选中图片
/// @param gif 动图
- (void)addItemWithTitle:(NSString *)title image:(NSString *)image selectedImage:(NSString *)selectedImage gif:(NSString *)gif;
/// 设置item选中
/// @param index 位置
- (void)setSelectItemWithIndex:(NSInteger)index;
/// 设置数字角标
/// @param index 位置
/// @param num 数字
- (void)setItemBadgeWithIndex:(NSInteger)index num:(NSInteger)num;
@end



NS_ASSUME_NONNULL_END
